package top.chmin.project.cloud.builder;

import org.springframework.stereotype.Component;

/**
 * chmin
 * 2023/12/15 15:21
 * cloud-builder
 */
@Component
public class DeleteByIdBuilder implements Builder {
    @Override
    public void build(BuilderConfig config) {
        String content = """
                package top.chmin.project.cloud.#e.module#.#e.pack#.auto;

                #import#

                /**
                 * chmin
                 * %s
                 * cloud-builder
                 */
                public interface #e.simpleName#DeleteById {

                    @PostMapping("/au/#e.fieldName#/deleteById")
                    int deleteById(@RequestBody Param param);

                    @Getter
                    @Setter
                    @Accessors(chain = true)
                    class Param {
                        private Long id;
                    }

                }
                """;

        save(config, config.getEntity().getClassName() + "DeleteById", content);
    }
}
